$(function(){

    var $btnView = $('#btnView');

    $btnView.click(function() {

        var $ranks = $('input[name="ranks"]:checked');

        var checkeds = new Array();
        $ranks.each(function(){
            checkeds.push($(this).val());
        });

        if(checkeds.length == 0){
            alert("请至少选择一个商品");
            return false;
        }else if(checkeds.length > 5){
            alert("最多只能选择5个商品");
            return false;
        }

        location.href = "/index.php/Admin/JdRank/?ids=" + checkeds.toString();

    });


});

function jd_rank_del(id){

    if(!confirm('确认要删除?')){
        return false;
    }

    $.post('/index.php/Admin/JdRank/delete',{'id':id},function(data){
        if(data.success){
            location.href = "/index.php/Admin/JdRank/";
        }else{
            alert(data.message);
        }
    },'JSON');
}